1. Field of the Invention
The present invention relates to a Moving Pictures Expert Group (MPEG) video decoder. More specifically, the present invention relates to an apparatus and operating method for managing frame buffers for decoding of video frames.
2. Description of the Related Art
Standardization of recording media, devices and various aspects of data handling, such as audio recording, storage and playback, is highly desirable for continued growth of this technology and its applications. One compression standard which has attained wide spread use for compressing and decompressing video information is the moving pictures expert group (MPEG) standard for audio and video encoding and decoding. The MPEG standard is defined in International Standard ISO/IEC 11172-1, "Information Technology--Coding of moving pictures and associated audio for digital storage media at up to about 1.5 Mbit/s", Parts 1, 2 and 3, First edition Aug. 1, 1993 (hereinafter referred to as MPEG International Standard).
Pictures defined by the MPEG standard are divided into 16.times.16 pixel macroblocks. Each macroblock has six 8.times.8 blocks including four luminance (Y) blocks, one chrominance red (Cr) block and one chrominance blue (Cb) block. The luminance blocks correspond to sets of 8.times.8 pixels on a display and control the brightness of respective pixels. The chrominance blocks control the colors for sets of 16.times.16 pixels. A set of 2.times.2 pixels on the display use a single Cr characteristic and a single Cb characteristic.
Three types of pictures of video information are defined and classified in the MPEG standard, intra-frames (I-frame), forward predicted pictures (P-frame) and bi-predicted pictures (B-frame).
An I-frame is encoded and decoded independently from other pictures in a video sequence as a single image having no reference to any past or future picture. Each block of an I-frame is encoded and decoded independently. Accordingly, when decoding an I-frame, no motion processing is necessary. However, I-frames are stored and accessed for use in decoding other types of pictures.
A P-frame is predicted from previous I-frames or P-frames. A P-frame is encoded and decoded relative to a most recent past reference picture where the reference picture is a P-frame or an I-frame. A macroblock in a P-frame is encoded as either an I-macroblock or a P-macroblock. A P-macroblock is stored as a translated 16.times.16 area of a past reference picture plus an error term. To specify the location of a P-macroblock, a motion vector which indicates the relative position of the macroblock in the current picture to the position of the translated area in the past reference picture is also encoded. A subsequently decoded P-macroblock includes the 16.times.16 area from the reference picture offset according to a defined motion vector. In this manner, the decoding of a macroblock inherently includes motion compensation with error-correction using inverse discrete cosine transform (IDCT) error terms which are defined on a block by block basis.
A B-frame is related to both the previous P-frames or I-frames and the future P-frames or I-frames. Thus, a B-frame is encoded relative to the most recent past reference picture and a next future reference picture. The decoding of a B-frame is similar to P-frame decoding with the exception that a B-frame motion vector may refer to areas in the future of the reference picture. For macroblocks that use both past and future reference pictures, 16.times.16 areas are averaged. The macroblocks from the reference pictures are offset using motion vectors.
A frame, whether an I-frame, P-frame or B-frame, cannot be simply decoded, displayed and discarded due to motion-compensation in which a frame is decoded based on other frames. P-frames and I-frames are retained in a frame buffer memory so that B-frames can be encoded and decoded based on the P-frames and I-frames. An I-frame and a P-frame are also retained in a frame buffer memory so that the frames are displayed in the correct temporal order. For example, encoded frames may be arranged in an order, as follows:
1I 4P 2B 3B 7P 5B 6B 10P 8B 9B 13I 11B 12B.
For such an arrangement of encoded frames, the correct display order is, as follows:
1I 2B 3B 4P 5B 6B 7P 8B 9B 10P 11B 12B 13I.
I-frame 1I and P-frame 4P are decoded and stored in frame buffers. I-frame 1I is displayed when an End-Of-Process (EOP) signal is received, signifying that the display of a previous frame is finished and a new frame may be displayed. B-frame 2B is decoded from the stored I-frame 1I and the stored P-frame 4P, displayed and discarded when the presentation is finished. Similarly, the B-frame 3B is decoded from I-frame 1I and P-frame 4P, displayed and discarded when the presentation is finished. The P-frame 4P is then displayed. Not until the P-frame 7P is decoded is the I-frame 1I discarded since the I-frame 1I is used for decoding the B-frames 2B and 3B and typically the P-frame 7P, but not needed for decoding of B-frames 5B and 6B. I-frame 1I is discarded and replaced with P-frame 7P which is decoded using the P-frame 4P and usually the I-frame 1I. The minimum number of frame buffers for decoding and displaying MPEG frames is three so that P-frames and B-frames can be decoded an all frames are displayed in the correct temporal order.
A three-buffer MPEG decoder is optimum for conserving circuit size but may have difficulty in meeting timing requirements in some implementations, including personal computer (PC) implementations.
What is needed is a multiple-buffer MPEG decoder that includes a sufficient but conservative amount of video buffering and meets stringent timing requirements of versatile PC environments.